package com.jx.mlxg.utils;

public class ResponseResult<T> {

    private int errno;
    private String errmsg;
<<<<<<< HEAD
    private T result;

    public ResponseResult(int errno, String errmsg, T result) {
        this.errno = errno;
        this.errmsg = errmsg;
        this.result = result;
    }

    public static <T> ResponseResult<T> success(T result) {
        return new ResponseResult<>(200, "", result);
    }

    public static <T> ResponseResult<T> success(String errmsg, T result) {
        return new ResponseResult<>(200, errmsg, result);
=======
    private T data;

    public ResponseResult(int errno, String errmsg, T data) {
        this.errno = errno;
        this.errmsg = errmsg;
        this.data = data;
    }

    public static <T> ResponseResult<T> success(T data) {
        return new ResponseResult<>(200, "", data);
    }

    public static <T> ResponseResult<T> success(String errmsg, T data) {
        return new ResponseResult<>(200, errmsg, data);
>>>>>>> eb72a42842a7e02f996c4f2d21dc4051aa14ecf1
    }

    public static <T> ResponseResult<T> failure(String errmsg) {
        return new ResponseResult<>(500, errmsg, null);
    }

    public static <T> ResponseResult<T> failure(int errno, String errmsg) {
        return new ResponseResult<>(errno, errmsg, null);
    }

    public int getErrno() {
        return errno;
    }

    public String getErrmsg() {
        return errmsg;
    }

<<<<<<< HEAD
    public T getResult() {
        return result;
=======
    public T getData() {
        return data;
>>>>>>> eb72a42842a7e02f996c4f2d21dc4051aa14ecf1
    }

    @Override
    public String toString() {
        return "ResponseResult{" +
                "errno=" + errno +
                ", errmsg='" + errmsg + '\'' +
<<<<<<< HEAD
                ", result=" + result +
=======
                ", data=" + data +
>>>>>>> eb72a42842a7e02f996c4f2d21dc4051aa14ecf1
                '}';
    }
}